<?php
	
require_once "../Social/FacebookHandler.php";

$fbh = new FacebookHandler($_GET['access_token']);
?>

<html>
<head>
	<title>Test</title>
</head>
<body>
	<?php 
		$fbh->setAccessToken($_GET['access_token']);
		$friends = $fbh->getFriendsList();
		if($friends == ERROR){
			echo "<h1>ERROR acquired</h1>";
		}else{
			echo "<h1>Your profile picture</h1><br>";
			$pic = $fbh->getProfilePicture("me");
			echo "<img src=\"$pic\" title=\"Profile Picture\"></img><br>";
			echo "<h1>Your Friends List</h1><br><ul>";
			foreach($friends['data'] as $friend){
				$pic = $fbh->getProfilePicture($friend['id']);
				echo "<li><ul><li><b>PHOTO</b><br><img src=\"$pic\"></img></li><li><b>ID:</b> ".$friend['id']."</li><li><b>NAME:</b> ".$friend['name']."</li></ul></li>";
			}
			echo "</ul>";
		}		
	?>
</body>
</html>
